/*
 * main.c
 *
 *  Created on: Jul 27, 2013
 *      Author: lxzhu
 */
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

void onDraw();

int main(int argc, char** argv){
	glutInit(&argc,argv);
	glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
	glutCreateWindow("FrontFace");
	glutDisplayFunc(onDraw);
	glutMainLoop();
	return 0;
}

void onDraw(){
	glClear(GL_COLOR_BUFFER_BIT);
	glPolygonMode(GL_FRONT,GL_FILL);
	glPolygonMode(GL_BACK,GL_LINE);

	glFrontFace(GL_CCW);
	//CCW
	glBegin(GL_POLYGON);
	 glVertex2f(-0.25,0.25);
	 glVertex2f(-0.25,0.75);
	 glVertex2f(-0.75,0.75);
	 glVertex2f(-0.75,0.25);
	glEnd();

	//CW
	glBegin(GL_POLYGON);
	 glVertex2f(0.25,0.25);
	 glVertex2f(0.25,0.75);
	 glVertex2f(0.75,0.75);
	 glVertex2f(0.75,0.25);
	glEnd();

	glutSwapBuffers();
}

